package io.github.lee.repository.jel.api

import io.github.lee.core.repository.data.Response
import io.github.lee.repository.jel.data.Page
import io.github.lee.repository.jel.domain.Item
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.Query

interface ItemApi {
    @GET("/Users/{userId}/Items/Resume")
    suspend fun playingList(
        @Path("userId") userId: String,
        @Query("startIndex") startIndex: Int? = null,
        @Query("limit") limit: Int? = null,
        @Query("enableImageTypes") imageTypes: String? = null,
        @Query("searchTerm") searchTerm: String? = null,
        @Query("fields") fields: List<String>? = null,
        @Query("mediaTypes") mediaTypes: List<String>? = null,
    ): Response<Page<Item>>

    @GET("/Users/{userId}/Items/Latest")
    suspend fun latest(
        @Path("userId") userId: String,
        @Query("parentId") parentId: String,
        @Query("startIndex") startIndex: Int? = null,
        @Query("limit") limit: Int? = null,
        @Query("enableImageTypes") imageTypes: String? = null,
    ): Response<List<Item>>

    @GET("/Users/{userId}/Items/{itemId}")
    suspend fun itemDetail(
        @Path("userId") userId: String,
        @Path("itemId") itemId: String,
    ): Response<Item>


    @GET("/Users/{userId}/Items")
    suspend fun userItems(
        @Path("userId") userId: String,
        @Query("ParentId") parentId: String,
        @Query("StartIndex") startIndex: Int,
        @Query("Limit") size: Int,
        @Query("recursive") recursive: Boolean? = true,
        @Query("includeItemTypes") includeItemTypes: List<String>? = null,
        @Query("filters") filters: List<String>? = null,
        @Query("sortBy") sortBy: List<String>? = null,
        @Query("sortOrder") sortOrder: String? = null,
    ): Response<Page<Item>>
}